﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
namespace BallData
{
    public class Bet007_StartNowOdds
    {
        //\"16|26660546|10BET|2.11|3.35|3.43|44.54|28.06|27.4|93.98|2.25|3.37|3.22|42.26|28.21|29.53|95.08|0.95|0.94|0.93|2012,11-1,09,12,02,00|10BET(英国)|1|0\",
        public String cId;
        public String r1;
        public String companyname;
        public String hostwinodds;
        public String pingodds;
        public String visitodds;
        public String hostwinpercent;
        public String pingpercent;
        public String visitpercent;
        public String getbackpercent;
        public String hostwin_nowodds;
        public String ping_nowodds;
        public String visit_nowodds;
        public String hostwin_nowpercent;
        public String ping_nowpercent;
        public String visit_nowpercent;
        public String getback_nowpercent;
        public String kaili1;
        public String kaili2;
        public String kaili3;
        public String changetime;
        public String fullcompanyname;
        public String maintype;
        public String rr2;


        
        public double d_hostwinodds;
        public double d_pingodds;
        public double d_visitodds;
        public double d_hostwinpercent;
        public double d_pingpercent;
        public double d_visitpercent;
        public double d_getbackpercent;
        public double d_hostwin_nowodds;
        public double d_ping_nowodds;
        public double d_visit_nowodds;
        public double d_hostwin_nowpercent;
        public double d_ping_nowpercent;
        public double d_visit_nowpercent;
        public double d_getback_nowpercent;
 


        public Bet007_StartNowOdds(String data)
        {
            String[] dataar = data.Split('|');
            cId = dataar[0];
            r1 = dataar[1];
            companyname = dataar[2];
            hostwinodds = dataar[3];
            if (hostwinodds.Length > 0)
                d_hostwinodds = Convert.ToDouble(hostwinodds);
            else
                d_hostwinodds = 0;
            pingodds = dataar[4];
            if (pingodds.Length > 0)
                d_pingodds = Convert.ToDouble(pingodds);
            else
                d_pingodds = 0;

            visitodds = dataar[5];
            if (visitodds.Length > 0)
                d_visitodds = Convert.ToDouble(visitodds);
            else
                d_visitodds = 0;

            hostwinpercent = dataar[6];
            if (hostwinpercent.Length > 0)
                d_hostwinpercent = Convert.ToDouble(hostwinpercent);
            else
                d_hostwinpercent = 0;

            pingpercent = dataar[7];
            if (pingpercent.Length > 0)
                d_pingpercent = Convert.ToDouble(pingpercent);
            else
                d_pingpercent = 0;

            visitpercent = dataar[8];
            if (visitpercent.Length > 0)
                d_visitpercent = Convert.ToDouble(visitpercent);
            else
                d_visitpercent = 0;

            getbackpercent = dataar[9];
            if (getbackpercent.Length > 0)
                d_getbackpercent = Convert.ToDouble(getbackpercent);
            else
                d_getbackpercent = 0;
 
            hostwin_nowodds = dataar[10];
            if (hostwin_nowodds.Length > 0)
                d_hostwin_nowodds = Convert.ToDouble(hostwin_nowodds);
            else
                d_hostwin_nowodds = 0;

            ping_nowodds = dataar[11];
            if (ping_nowodds.Length > 0)
                d_ping_nowodds = Convert.ToDouble(ping_nowodds);
            else
                d_ping_nowodds = 0;

            visit_nowodds = dataar[12];
            if (visit_nowodds.Length > 0)
                d_visit_nowodds = Convert.ToDouble(visit_nowodds);
            else
                d_visit_nowodds = 0;
            
            hostwin_nowpercent = dataar[13];
            if (hostwin_nowpercent.Length > 0)
                d_hostwin_nowpercent = Convert.ToDouble(hostwin_nowpercent);
            else
                d_hostwin_nowpercent = 0;
            
            ping_nowpercent = dataar[14];
            if (ping_nowpercent.Length > 0)
                d_ping_nowpercent = Convert.ToDouble(ping_nowpercent);
            else
                d_ping_nowpercent = 0;
            
            visit_nowpercent = dataar[15];
            if (visit_nowpercent.Length > 0)
                d_visit_nowpercent = Convert.ToDouble(visit_nowpercent);
            else
                d_visit_nowpercent = 0;
            
            getback_nowpercent = dataar[16];
            if (getback_nowpercent.Length > 0)
                d_getback_nowpercent = Convert.ToDouble(getback_nowpercent);
            else
                d_getback_nowpercent = 0;
            
            kaili1 = dataar[17];
            kaili2 = dataar[18];
            kaili3 = dataar[19];
            changetime = dataar[20];
            fullcompanyname = dataar[21];
            maintype = dataar[22];
            rr2 = dataar[23];

        }
    }
    public class Bet007_OddsAllcompany
    {
        public String matchname;
        public String matchname_cn;
        public String MatchTime;
        public String ScheduleID;
        public String hometeam;
        public String guestteam;
        public String hometeam_cn;
        public String guestteam_cn;
        public String hometeamID;
        public String guestteamID;
        public Hashtable hashcompanyodds = new Hashtable();
        public Bet007_OddsAllcompany(String data)
        {
            MatchCollection mc;
            mc = Regex.Matches(data, "var matchname=\"(?<matchname>.*)\";\r\nvar matchname_cn=\"(?<matchname_cn>.*)\";\r\nvar MatchTime=\"(?<MatchTime>.*)\";\r\nScheduleID=(?<ScheduleID>\\d+);\r\nhometeam=\"(?<hometeam>.*)\";\r\nguestteam=\"(?<guestteam>.*)\";\r\nhometeam_cn=\"(?<hometeam_cn>.*)\";\r\nguestteam_cn=\"(?<guestteam_cn>.*)\";\r\nhometeamID=(?<hometeamID>\\d+);\r\nguestteamID=(?<guestteamID>\\d+);\r\ngame=Array\\((?<game>.*)\\);\r\n");
            foreach (Match match in mc)
            {
                GroupCollection gc = match.Groups;
                matchname = gc["matchname"].Value;
                matchname_cn = gc["matchname_cn"].Value;
                MatchTime = gc["MatchTime"].Value;
                ScheduleID = gc["ScheduleID"].Value;
                hometeam = gc["hometeam"].Value;
                guestteam = gc["guestteam"].Value;
                hometeam_cn = gc["hometeam_cn"].Value;
                guestteam_cn = gc["guestteam_cn"].Value;
                hometeamID = gc["hometeamID"].Value;
                guestteamID = gc["guestteamID"].Value;

                String allcompanyodds = gc["game"].Value;

                MatchCollection mc1 = Regex.Matches(allcompanyodds, "\"(?<odds>.*?)\"");

                foreach (Match match1 in mc1)
                {
                    GroupCollection gc1 = match1.Groups;
                    
                    Bet007_StartNowOdds odds = new Bet007_StartNowOdds(gc1["odds"].Value);
                    hashcompanyodds.Add(odds.cId,odds);
                }

                


            }
        }
        

    }
}
